﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace AcademiaInteligenteWeb
{
    public partial class NewPlayList : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            int idPlaylist;
            if (!IsPostBack)
            {
                if (int.TryParse(Request["id"], out idPlaylist))
                {   
                                      
                }
            }
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            WsAcademiaInteligente.Playlist playList = new WsAcademiaInteligente.Playlist();
            playList.descricao = txtDescricao.Text;                       
            
             int idPlayList;
             if (int.TryParse(Request["id"], out idPlayList))
            {
                playList.id = idPlayList;
                new WsAcademiaInteligente.WsAcademiaInteligenteSoapClient().AlterarPlayList(playList);
            }
            else
            {
                new WsAcademiaInteligente.WsAcademiaInteligenteSoapClient().InserirPlayList(playList);
            }
             
             Response.Redirect("MainPlayList.aspx");
        }
        
      }
    }
       

